
str = require( "string")
io = require( "io" )
jk = require( "jlink" )

print( str.format( "%x\n", jk.Version() ) )

jk.Halt()
jk.WriteReg( 8, 0x400000D3 )
pc = jk.ReadReg( 9 )
print( str.format( "halt, %x", pc ) )

tt, err = io.readfile( "/home/wmd/work/gitee2/ky3001/flash/aflash.bin" )
tt = str.sub( tt, 17 )
jk.WriteMem( 0x100000, tt )

jk.WriteReg( 9, 0x100000 )
pc = jk.ReadReg( 9 )
print( str.format( "run, %x", pc ) )

jk.Go()




